<?php
class Registry{
    private $vars = array();
    private static $instance;

    private function __construct(){

    }

    static function getInstance(){
        if(! isset(self::$instance)){
            self::$instance = new self();
        }
        return self::$instance;
    }

    function set($key, $var){
        if(isset($this->vars[$key]) == true){
            throw new Exception('Unable to set var "' . $key . '". Already set.');

        }

        $this->vars[$key] = $var;

        return true;
    }

    function setAuth($val){
        if(isset($this->auth)){
            $this->auth = $val;
        }
    }

    function getAuth(){
        if(isset($this->auth)){
            return $this->auth;
        }
    }

    function get($key){
        if(isset($this->vars[$key]) == false){
            return null;
        }

        return $this->vars[$key];
    }

    function remove($var){
        unset($this->vars[$key]);
    }

    
}
?>
